## Replication files for What Explains Low Female Political Representation? Evidence from Survey Experiments in Japan, Politics & Gender, 15: 285–309.

## Study 1
# There are two module: module 1 for 'Electing a Politician' and module 2 for 'Promoting a Politician'
# Main data for Study 1: dataset1
library(foreign)
library(tidyverse)
library(cjoint)
library(dplyr)
library(ggplot2)

# module 1
data <- read.csv("dataset1.csv")
data1 <- subset(data, module == 1)

data1$m1_gender<-factor(data1$m1_gender, levels=c("Male", "Female"))
data1$m1_party <-factor(data1$m1_party, levels=c("LDP","DPJ","JCP","Komei","Restoration"))
data1$m1_consumption <-factor(data1$m1_consumption, levels=c("Increase","Postponement","Decrease")) 
data1$m1_manifesto <-factor(data1$m1_manifesto, levels=c("Deregulation","SMEs and Local","Welfare"))
data1$m1_age <-factor(data1$m1_age, levels=c("Age 35", "Age 45","Age 55"))
data1$m1_exper <-factor(data1$m1_exper, levels=c("None","City council","Prefecture council")) 
data1$m1_edu <-factor(data1$m1_edu, levels=c("High school","College","Graduate school"))
data1$m1_child <-factor(data1$m1_child, levels=c("No children","Over 6 with grandparents","Over 6 without grandparents","Under 6 with grandparents","Under 6 without grandparents")) 
data1$m1_marital <-factor(data1$m1_marital, levels=c("Married","Divorced","Has been single")) 

attribute_list <- list() 
attribute_list[["m1_gender"]] <-c("Male","Female") 
attribute_list[["m1_party"]] <- c("LDP","DPJ","JCP","Komei","Restoration") 
attribute_list[["m1_consumption"]] <- c("Increase","Postponement","Decrease") 
attribute_list[["m1_manifesto"]] <- c("Deregulation","SMEs and Local","Welfare")
attribute_list[["m1_age"]] <- c("Age 35", "Age 45","Age 55")
attribute_list[["m1_exper"]] <- c("None","City council","Prefecture council") 
attribute_list[["m1_edu"]] <- c("High school","College","Graduate school")
attribute_list[["m1_child"]] <- c("No children","Over 6 with grandparents","Over 6 without grandparents","Under 6 with grandparents","Under 6 without grandparents") 
attribute_list[["m1_marital"]] <- c("Married","Divorced","Has been single") 

constraint_list <- list() # Constraints on Education and Job attributes 
m1_design <- makeDesign(type='constraints', attribute.levels=attribute_list, constraints=constraint_list)

amce_m1 <- amce(chosen ~ m1_gender + m1_party + m1_consumption + m1_manifesto + m1_age + m1_exper + m1_edu + m1_child + m1_marital, data=data1, respondent.id="resid", cluster=TRUE, na.ignore=TRUE, design=m1_design, weights="weight_uncapped")
summary(amce_m1)


# module 2
data2 <- subset(data, module == 2)

data2$m2_gender<-factor(data2$m2_gender, levels=c("Male", "Female"))
data2$m2_age <-factor(data2$m2_age, levels=c("Age 35", "Age 45","Age 55"))
data2$m2_exper <-factor(data2$m2_exper, levels=c("Elected 5 times","Elected 5 times in a row","Elected 6 times in a row")) 
data2$m2_edu <-factor(data2$m2_edu, levels=c("High school","College","Graduate school"))
data2$m2_child <-factor(data2$m2_child, levels=c("No children","Over 6 with grandparents","Over 6 without grandparents","Under 6 with grandparents","Under 6 without grandparents")) 
data2$m2_marital <-factor(data2$m2_marital, levels=c("Married","Divorced","Has been single")) 

attribute_list <- list() 
attribute_list[["m2_gender"]] <-c("Male","Female") 
attribute_list[["m2_age"]] <- c("Age 35", "Age 45","Age 55")
attribute_list[["m2_exper"]] <- c("Elected 5 times","Elected 5 times in a row","Elected 6 times in a row") 
attribute_list[["m2_edu"]] <- c("High school","College","Graduate school")
attribute_list[["m2_child"]] <- c("No children","Over 6 with grandparents","Over 6 without grandparents","Under 6 with grandparents","Under 6 without grandparents") 
attribute_list[["m2_marital"]] <- c("Married","Divorced","Has been single") 

constraint_list <- list() # Constraints on Education and Job attributes 
m2_design <- makeDesign(type='constraints', attribute.levels=attribute_list, constraints=constraint_list)

amce_m2 <- amce(chosen ~ m2_gender + m2_age + m2_exper + m2_edu + m2_child + m2_marital, data=data2, respondent.id="resid", cluster=TRUE, na.ignore=TRUE, design=m2_design, weights="weight_uncapped")
summary(amce_m2)



## Study 2
# Data for Study 2: dataset2
# The main dependent variable is 'evaluation'
# There are two experimental variables: 1. eval_gender: binary (0 = male, 1 = female); 2. eval_nationality: categorical with three levels (1 = Japanese author, 2 = Korean author, 3 = American author)
# Statistics used in the paper were calculated using eval_gender * eval_nationality (==1)



## Study 3
# Data for Study 3: 2014UTASP20150910_newcandidate
library(foreign)
library(ggplot2)
data3 <- read.table("2014UTASP20150910_newcandidate.csv", header=T, sep="\t", quote="")
names(data3)

data3$sex <- factor(data3$sex, levels=c(1,2), labels=c("Male Candidates", "Female Candidates"))

# SMD system
data3_smd <- subset(data3, pr == 0)

smd = ggplot(data3_smd, aes(x=age)) + geom_histogram(aes(y=..density..), binwidth=5, alpha=.5, colour="black", fill="black") + facet_grid(. ~ sex) + geom_density() + labs(title="Difference in Entry Age under SMD") + ylab("Density") + xlab("Candidates' Age") + scale_x_continuous(limits=c(20,80)) 

# PR system
data3_pr <- subset(data3, pr == 1)

pr = ggplot(data3_pr, aes(x=age)) + geom_histogram(aes(y=..density..), binwidth=5, alpha=.5, colour="black", fill="black") + facet_grid(. ~ sex) + geom_density() + labs(title="Difference in Entry Age under PR") + ylab("Density") + xlab("Candidates' Age") + scale_x_continuous(limits=c(20,80)) 


## Study 4
# Data for Study 4: dataset4
# Original dataset is called dataset4_original
# The main dependent variable is 'willingess_run'
# The experimental variable is 'T_encourage_pol' in dataset4_original or "Treatment' in dataset4

library(foreign)
library(ggplot2)

# mean approval rates
data4<-read.csv("dataset4.csv", header=T, sep=",")

newdata4 <- subset(data4, Treatment == 1 | Treatment == 2 | Treatment == 3)

# mean approval rates only for women
plot_women <-ggplot(newdata4,aes(x=Treatment, y=willingness_run_f, fill=T_encourage_pol)) + coord_cartesian(ylim = c(0, 3)) + geom_bar(position="dodge", stat="identity", width=.7) +  xlab("") + ylab("Mean willingness to run") + scale_fill_hue(name="", labels=c("Control","With support","Without support")) + ggtitle("Female respondents") + theme(legend.key=element_rect(colour=NA)) + theme(legend.text=element_text(size=rel(1))) + theme(title=element_text(size=rel(1))) + theme(axis.title.y = element_text(size = rel(1), angle = 90)) + theme(axis.text.x = element_blank(), axis.text.y = element_text(size = rel(1))) + theme(axis.title.x = element_text(size = rel(1), angle = 00)) 

# mean approval rates only for men
plot_men <-ggplot(newdata4,aes(x=Treatment, y=willingness_run_m, fill=T_encourage_pol)) + coord_cartesian(ylim = c(0, 3)) + geom_bar(position="dodge", stat="identity", width=.7) +  xlab("") + ylab("Mean willingness to run") + scale_fill_hue(name="", labels=c("Control","With support","Without support")) + ggtitle("Male respondents") + theme(legend.key=element_rect(colour=NA)) + theme(legend.text=element_text(size=rel(1))) + theme(title=element_text(size=rel(1))) + theme(axis.title.y = element_text(size = rel(1), angle = 90)) + theme(axis.text.x = element_blank(), axis.text.y = element_text(size = rel(1))) + theme(axis.title.x = element_text(size = rel(1), angle = 00)) 
